package com.iss.airsys.dao;

import com.iss.airsys.entity.FixAssets;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface FixAssetsDao {
    @Insert("insert into fixAssets values (null,#{assets_name},#{assets_price},#{assets_num},#{assets_usedNum})")
    Integer insertfixAssets(FixAssets fixAssets);

    @Select("select assets_id,assets_name,assets_price,assets_num,assets_usedNum from fixAssets")
    List<FixAssets> selectAllfixAssets();
    @Delete(" <script>"+"delete from fixAssets where assets_id in" +
            "    <foreach collection=\"array\" item=\"id\" separator=\",\" open=\"(\" close=\")\">" +
            "        #{id}" +
            "    </foreach></script>")
    Integer deletefixAssets(Integer[] assets_id_Array);
    @Update("update fixAssets set assets_name=#{assets_name},assets_price=#{assets_price},assets_num=#{assets_num},assets_usedNum=#{assets_usedNum} where assets_id=#{assets_id}")
    Integer updatefixAssets(FixAssets fixAssets);
    @Select("select * from fixAssets where assets_id=#{assets_id}")
    FixAssets selectfixAssetsById(Integer assets_id);

    @Update("update fixAssets set assets_surface = #{surface},assets_info = #{info} where assets_id=#{id} ")
    public Integer updateInfo(@Param("surface") String surface,@Param("info") String info,@Param("id") Integer id);
}
